package sample;

import javafx.beans.property.SimpleStringProperty;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class CarPark {
    private SimpleStringProperty carParkName = new SimpleStringProperty();
    private SimpleStringProperty carParkTopic = new SimpleStringProperty();

    public String getCarParkName() {
        return carParkName.get();
    }

    public SimpleStringProperty carParkNameProperty() {
        return carParkName;
    }

    public void setCarParkName(String carParkName) {
        this.carParkName.set(carParkName);
    }

    public String getCarParkTopic() {
        return carParkTopic.get();
    }

    public SimpleStringProperty carParkTopicProperty() {
        return carParkTopic;
    }

    public void setCarParkTopic(String carParkTopic) {
        this.carParkTopic.set(carParkTopic);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        CarPark carPark = (CarPark) o;

        return new EqualsBuilder()
                .append(carParkTopic.getValue(), carPark.carParkTopic.getValue())
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(carParkTopic.getValue())
                .toHashCode();
    }

    @Override
    public String toString() {
        return carParkName.getValue();
    }
}
